package com.deliveryservicesystem.service;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * File Name: GeneralServices.java
 * Version:
 * Description:
 * Package: com.deliveryservicesystem.service.impl
 * Author: Lance
 * Date: Jun 20, 2012
 * Editor:
 */
public interface GeneralServices
{

    /**
     * Get data returned by the procedureSql
     *
     * @param procedureSql to execute. Make sure the format is as follows -
     * BEGIN ? := PACHAGE_NAME.PROCEDURE_NAME; END;
     * eg. BEGIN ? := GET_DATA.BILLINGS; END;
     * @return ResultSet
     * @throws SQLException
     */
    public ResultSet getTableDataFromProcedure(String procedureSql) throws SQLException;

    /**
     * Get data returned by the sql
     *
     * @param sql to execute. Make sure the format is as follows -
     * SELECT COLUMN_LIST FROM TABLE_NAME [WHERE COLUMN_NAME = VALUE]
     * eg. SELECT * FROM CUSTOMER NB! No semicolon!
     * @return ResultSet
     * @throws SQLException
     */
    public ResultSet getTableDataFromSql(String sql) throws SQLException;

    /**
     * Get data returned by rowId and tableName the sql that will execute
     * is the following SELECT * FROM tableName WHERE columnId = recordId
     *
     * @param columnId the column name of the primary key
     * @param tableName the table name to search from
     * @param recordId the primaryKey to search for
     * @return ResultSet
     * @throws SQLException
     */
    public ResultSet getRecordFromTable(String columnId, String tableName, String recordId) throws SQLException;
}
